home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 4 / FM Towns Free Software Collection 4 - Disc 1.iso / t_os / whisper / source / msg2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-19  |  1.5 KB  |  71 lines

  1. static BLOCK    DIA_save=NULL;
  2.  
  3. typedef struct _DIA {
  4.     struct _DIA    *next;
  5.     EVENT    *ep;
  6.     short    mode;
  7.     int        no;
  8.     short    hit;
  9.     char    *mac;
  10.     char    *str;
  11. } DIANODE;
  12.  
  13. DIANODE    *topdia=NULL;
  14.  
  15. void    DIA_hit(DIANODE *np)
  16. {
  17.     int     no;
  18.     EVENT   *ep;
  19.     DIANODE *tp;
  20.  
  21.     no = macval(np->mac);
  22.     for ( tp = topdia ; tp != NULL ; tp = tp->next ) {
  23.     if ( tp->mode == DIA_SW && strcmp(tp->mac,np->mac) == 0 ) {
  24.         if ( (tp->hit != FALSE && tp->no != no) ||
  25.          (tp->hit == FALSE && tp->no == no) ) {
  26.         ep = tp->ep;
  27.         tp->hit = (tp->hit == FALSE ? TRUE:FALSE);
  28.         MOS_disp(FALSE);
  29.         DSP_xline(ep->x1,ep->y1,ep->x2,ep->y2,8,4);
  30.         MOS_disp(TRUE);
  31.         }
  32.     }
  33.     }
  34. }
  35.  
  36. void    DIA_sw(int x,int y,int col,int chr,int no,char *ttl,char *mac)
  37. {
  38.     DIANODE *np;
  39.  
  40.     if ( (np = (DIANODE *)malloc(sizeof(DIANODE))) == NULL )
  41.     return;
  42.  
  43.     np->next = topdia;
  44.     topdia = np;
  45.     np->ep = EVT_big_sw(x,y,ttl,7,8,col,chr,600,DIA_event,(int)np);
  46.     np->mode = DIA_SW;
  47.     np->no = no;
  48.     np->hit = FALSE;
  49.     np->mac = strdup(mac);
  50.     np->str = NULL;
  51. }
  52.  
  53. void    DIA_open(int x1,int y1,int x2,int y2,int col)
  54. {
  55.     MOS_disp(FALSE);
  56.     MOS_push(x1,y1,x2,y2);
  57.     DIA_save = DSP_push_vram(x1,y1,x2,y2);
  58.     DSP_rbox(x1,y1,x2,y2,7,8,col);
  59.     MOS_setpos((x1+x2)/2,(y1+y2)/2);
  60. }
  61. void    DIA_close()
  62. {
  63.     if ( DIA_save != NULL ) {
  64.     EVT_level_free(600);
  65.     MOS_disp(FALSE);
  66.     DSP_pop_vram(DIA_save);
  67.     MOS_push(ERR,ERR,ERR,ERR);
  68.     DIA_save = NULL;
  69.     }
  70. }
  71.